package cate.game.activity;

import cate.common.table.d.GDFunc;
import cate.game.GameBody;
import cate.game.activity.base.core.ActivityHandler;
import cate.game.activity.base.core.RoleActivitySingle;
import cate.game.activity.battleroyale.BattleRoyaleHandler;
import cate.game.activity.godequip.GodEquipActivity;
import cate.game.activity.godtree.GodTreeActivity;
import cate.game.activity.luckybag.LuckyBagActivity;
import cate.game.activity.moonfight.MoonFightActivityHandler;
import cate.game.activity.moonfight.msg.MoonFightGlobalInfoResp;
import cate.game.activity.specialtraining.SpecialTrainingActivity;
import cate.game.admin.menu.MenuSetup;

public class ActivityMenu extends MenuSetup {
    public ActivityMenu(GameBody gameBody) {
        super("活动相关");
        reg(
                gameBody,
                "重开积天豪礼活动",
                0,
                "",
                (master, params) -> {
                    master.getActivity().getEnableActivitySingle(GDFunc.SAVINGS_REBATE).onRoleEnd();
                    master.getActivity().getEnableActivitySingle(GDFunc.SAVINGS_REBATE).onRoleOpen();
                    master.getActivity().getEnableActivitySingle(GDFunc.SAVINGS_REBATE).initSend();
                    gameBody.notice.message(master, "修改成功");
                }
        );

        reg(
                gameBody,
                "重开七日计划活动",
                0,
                "",
                (master, params) -> {
                    SpecialTrainingActivity single = master.getActivity().getEnableActivitySingle(GDFunc.ACT_SEVEN_DAY_SPECIAL_TRAINING);
                    single.onRoleEnd();
                    single.onEnter();
                    single.excelCheck();
                    single.initSend();
                    gameBody.notice.message(master, "修改成功");
                }
        );

        reg(
                gameBody,
                "清空食神记通关记录",
                0,
                "全服通过记录，一键清空",
                (master, params) -> {
                    BattleRoyaleHandler handler = master.getGame().activityGlobal.getHandler(GDFunc.BATTLE_ROYALE);
                    if (handler != null) {
                        handler.getGlobalData().clear();
                        gameBody.notice.message(master, "修改成功");
                    }
                }
        );

        reg(
                gameBody,
                "添加福袋积分",
                1,
                "要添加的数量",
                (master, params) -> {
                    long num = Long.parseLong(params.get(0));
                    LuckyBagActivity handler = master.getActivity().getEnableActivitySingle(GDFunc.LUCKY_BAG);
                    if (handler != null) {
                        handler.addScore(num);
                        gameBody.notice.message(master, "修改成功");
                    }
                }
        );

        reg(
                gameBody,
                "神装寻宝",
                1,
                "要添加的数量",
                (master, params) -> {
                    int num = Integer.parseInt(params.get(0));
                    GodEquipActivity handler = master.getActivity().getEnableActivitySingle(GDFunc.GOD_EQUIP);
                    if (handler != null) {
                        handler.GMAddDrawTimes(num);
                        gameBody.notice.message(master, "修改成功");
                    }
                }
        );

        reg(
                gameBody,
                "觉醒神树",
                1,
                "目标等级",
                (master, params) -> {
                    int num = Integer.parseInt(params.get(0));
                    GodTreeActivity handler = master.getActivity().getEnableActivitySingle(GDFunc.GOD_TREE);
                    if (handler != null) {
                        boolean level = handler.GMLevelUp(num);
                        if (level) {
                            gameBody.notice.message(master, "修改成功");
                        } else {
                            gameBody.notice.message(master, "等级不存在");
                        }
                    }
                }
        );

        reg(
                gameBody,
                "重置月下剑弈(比武)",
                0,
                "目标等级",
                (master, params) -> {
                    MoonFightActivityHandler handler = master.getGame().activityGlobal.getEnableHandler(GDFunc.MOON_FIGHT);
                    if (handler != null) {
                        handler.getGlobalData().clear();
                        handler.onActOpen();
                        master.sendNow(new MoonFightGlobalInfoResp(handler.getGlobalData()));
                        gameBody.notice.message(master, "重置成功");
                    }
                }
        );
    }
}
